package com.softstao.guoyu.mvp.presenter.me;

import com.softstao.guoyu.model.me.AgentInfo;
import com.softstao.guoyu.model.me.ApplyListIndex;
import com.softstao.guoyu.model.me.Balance;
import com.softstao.guoyu.model.me.BalanceIndex;
import com.softstao.guoyu.model.me.RechargeApply;
import com.softstao.guoyu.model.me.RechargeCondition;
import com.softstao.guoyu.mvp.interactor.me.BalanceInteractor;
import com.softstao.guoyu.mvp.presenter.BasePresenter;
import com.softstao.guoyu.mvp.viewer.BaseViewer;
import com.softstao.guoyu.mvp.viewer.me.ApplyListViewer;
import com.softstao.guoyu.mvp.viewer.me.BalanceIndexViewer;
import com.softstao.guoyu.mvp.viewer.me.RechargeApplyListViewer;
import com.softstao.guoyu.mvp.viewer.me.RechargeApplyViewer;
import com.softstao.guoyu.mvp.viewer.me.RechargeListViewer;
import com.softstao.guoyu.mvp.viewer.me.RechargeViewer;

/**
 * Created by vaikus on 2017/6/15.
 */

public class BalancePresenter extends BasePresenter<BaseViewer, BalanceInteractor> {
    public void getRechargeList(int page,int agentId,int inorout){
        interactor.getRechargeList(page,agentId,inorout,o -> ((RechargeListViewer)viewer).getResult((Balance) o));
    }

    public void getBalance(int agentId){
        interactor.getBalance(agentId,o -> ((BalanceIndexViewer)viewer).getIndex((BalanceIndex) o));
    }

    public void getApplyList(int page,int agentId, String search){
        interactor.getApplyList(page,agentId,search, o -> ((ApplyListViewer)viewer).getApplyList((ApplyListIndex) o));
    }

    public void getAgentInfo(int agentId,int subAgentId){
        interactor.getAgentInfo(agentId,subAgentId,o -> ((RechargeViewer)viewer).getAgentInfo((AgentInfo) o));
    }

    public void addRecharge(RechargeCondition condition){
        interactor.addRecharge(condition,o -> ((RechargeViewer)viewer).addResult(o));
    }

    public void getRechargeApply(int page,int agentId,String state){
        interactor.getRechargeApply(page,agentId,state,o -> ((RechargeApplyListViewer)viewer).getRechargeApplyList((RechargeApply) o));
    }

    public void urge(int agentId,int applyId){
        interactor.urge(agentId,applyId,o -> ((RechargeApplyListViewer)viewer).urgeResult(o));
    }

    public void cancel(int agentId,int applyId,String reason){
        interactor.cancel(agentId,applyId,reason,o -> ((RechargeApplyListViewer)viewer).cancelResult(o));
    }

    public void apply(RechargeCondition condition){
        interactor.apply(condition,o -> ((RechargeApplyViewer)viewer).applyResult(o));
    }
}
